﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CarShop
{
    public abstract class Vehicle : IDiscount
    {
        private string brand;
        private string model;
        private string color;
        private int yearOfProduction;
        private int maxSpeed;
        private int price;

        //abstract constructor
        public Vehicle(string brand, string model, string color, int year, int speed, int price)
        {
            this.Brand = brand;
            this.Model = model;
            this.Color = color;
            this.YearOfProduction = year;
            this.MaxSpeed = speed;
            this.Price = price;
        }

        public int Price
        {
            get
            {
                return this.price;
            }
            set
            {
                this.price = value;
            }
        }

        public int MaxSpeed
        {
            get
            {
                return this.maxSpeed;
            }
            set
            {
                this.maxSpeed = value;
            }
        }

        public int YearOfProduction
        {
            get
            {
                return this.yearOfProduction;
            }
            set
            {
                this.yearOfProduction = value;
            }
        }

        public string Color
        {
            get
            {
                return this.color;
            }
            set
            {
                this.color = value;
            }
        }

        public string Model
        {
            get
            {
                return this.model;
            }
            set
            {
                this.model = value;
            }
        }

        public string Brand
        {
            get
            {
                return this.brand;
            }
            set
            {
                this.brand = value;
            }
        }

        public abstract string AdditionalInfo();

        public int CalculateDiscount(int discount)
        {
            return this.Price - discount;
        }

        public override string ToString()
        {
            StringBuilder engineText = new StringBuilder();
            engineText.AppendLine("Brand: " + this.Brand.ToString());
            engineText.AppendLine("Model: " + this.Model.ToString());
            engineText.AppendLine("Color: " + this.Color.ToString());
            engineText.AppendLine("Year of production: " + this.YearOfProduction.ToString());
            engineText.AppendLine("Price: " + this.Price.ToString("C"));
            return engineText.ToString();
        }
    }
}